<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of manipulasi
 *
 * @author Obi
 */
class M_produk extends DataMapper {

    var $table = 'produk';
    var $key = 'id';

    function __construct() {
        parent::__construct();
    }

    //put your code here
    function insert($form) {
        $this->db->insert($this->table, $form);
    }

    function update($form, $id) {
        $this->db->where($this->key, $id);
        $this->db->update($this->table, $form);
    }

    function delete($id) {
        $this->db->where($this->key, $id);
        $this->db->delete($this->table);
    }

    function report_porduk() {
        $sql = "select 
                    produk.* 
                from 
                    produk
               ";
        $query = $this->db->query($sql);
        return $query->result();
    }
	
	function select_data() {
        $sql = "select
                produk.id,produk.nama_produk,produk.warna,produk.harga,produk.disk,produk.stok,produk.id_katagori,produk.keterangan,produk.tanggal,produk.image1,produk.image2,produk.image3,produk.status
            from  
                produk Left Join katagori ON produk.id_katagori=katagori.parentid";

        $query = $this->db->query($sql);
        return $query->result();
    }

}

?>
